﻿namespace MicroCloud.Entity.SqlServer
{
    #region "SqlServer-DbContext迁移模块基类"
    /// <summary>
    /// SqlServer-DbContext迁移模块基类
    /// </summary>
    /// <typeparam name="TDbContext">数据上下文类型</typeparam>
    [DependsOnPacks(typeof(SqlServerEntityFrameworkCorePack))]
    [Description("SqlServer-DbContext迁移模块")]
    public abstract class SqlServerDbContextMigrationPackBase<TDbContext> : MigrationPackBase<TDbContext>
        where TDbContext : DbContext, IDbContext
    {
        #region "属性"
        /// <summary>
        /// 获取 数据库类型
        /// </summary>
        protected override DatabaseType DatabaseType => DatabaseType.SqlServer;

        #endregion

        #region "重写方法"
        #region "重写实现获取数据上下文实例"
        /// <summary>
        /// 重写实现获取数据上下文实例
        /// </summary>
        /// <param name="scopedProvider">服务提供者</param>
        /// <returns></returns>
        protected override TDbContext CreateDbContext(IServiceProvider scopedProvider)
        {
            return new DesignTimeDbContextFactory<TDbContext>(scopedProvider).CreateDbContext(Array.Empty<string>());
        }
        #endregion

        #endregion

    }
    #endregion

}
